import { IMyObject, MyObject } from "./MyObject";

export enum SubjectType{
    None,
  Chinese,
  English,
  Math,
  Physical,
  Chemistry,
  Biology,
}
export interface ISubject extends IMyObject{
    /**
   * 老师姓名
   */
  subTeacher: string;

  /**
   * 老师授课科目
   */
  type: SubjectType;
}
export class Subject extends MyObject implements ISubject{
    subTeacher=''
  type: SubjectType = SubjectType.None;

  constructor(type: SubjectType,  subTeacher: string) {
    super()
    this.subTeacher = subTeacher
    this.type = type
   
    this.initName();
  }

private initName() {
    switch (this.type) {
      case SubjectType.None:
        this.name = "无"
        break;
      case SubjectType.Chinese:
        this.name = "语文"
        break;
      case SubjectType.English:
        this.name = "英语"
        break;
      case SubjectType.Math:
        this.name = "数学"
        break;
      case SubjectType.Physical:
        this.name = "物理"
        break;
      case SubjectType.Chemistry:
        this.name = "化学"
        break;
      case SubjectType.Biology:
        this.name = "生物"
        break;
    }
  }
  toString(): string {
    if(this.type>0&&this.type<7)
    return this.subTeacher
    else
    return "没有老师"
  }
}
